admin.factory('adminService', function($http, $q, $state, $stateParams, $timeout, $log) {
	return {
		getNotifys: function($scope) {
			var deferred = $q.defer();
            var promise = deferred.promise;  
			$http({
				method: "GET",
				url: "/hake-ui/data/notifications.json"
			}).success(function(data, status, headers, config) {
				if(status == 200) {
					deferred.resolve(data);
				} else{
					deferred.reject("获取数据失败！");
				}
				//$scope.notifys = data ;
			}).error(function() {
				deferred.reject("通讯失败");
			});
			return promise;
		},
		getBookList: function($scope) {
			$http({
				method: 'GET',
				url: '/hake-ui/data/books0.json'
			}).success(function(result, status, headers, config) {
				$scope.gridOptions.data = result ;
				$log.log(result) ;
			}).error(function(result, status, headers, config) {
				$log.error(status) ;
			});
		}
		
		/*getNotifys: function($scope) {
			$http({
				method: "GET",
				url: "/hake-ui/data/notifications.json"
			}).success(function(data, status, headers, config) {
				console.info(status)
				$scope.notifys = data ;
			}).error(function() {
				console.info("error");
			});
		}*/
		
	}
})